package com.project.springboot.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.project.springboot.enums.ProductStatusEnum;
import com.project.springboot.utils.EnumUtil;
import lombok.Data;

/**
 * Description：商品数据传输对象
 * Created by 朱正磊 on 2019/3/18 0018 下午 3:01
 */
@Data
@JsonInclude(Include.NON_NULL)
public class ProductDTO {

    private String pname;

    private String username;

    private String email;

    /** 商品状态： 0-上架；1-下架. */
    private Integer productStatus = ProductStatusEnum.UP.getCode();

    @JsonIgnore
    public ProductStatusEnum getProductStatusEnum() {
        return EnumUtil.getByCode(productStatus, ProductStatusEnum.class);
    }

}
